package com.springboot.hiresystem.config;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.*;

@ComponentScan(basePackages = "com.springboot.hiresystem")
@SpringBootApplication
@Slf4j
@MapperScan(basePackages = {"com.springboot.hiresystem.mapper"})
public class HireSystemApplication {

	public static void main(String[] args) {
//        SpringApplication.run(WikiProjectApplication.class, args);
		// 获取spring容器
		SpringApplication springApplication = new SpringApplication(HireSystemApplication.class);
		// 获取端口号
		String prot = springApplication.run(args).getEnvironment().getProperty("server.port");
		//启动日志
		log.info("启动成功");
		// 打印项目地址
		log.info("http://localhost:/" + prot);
	}
	@RestController
	@RequestMapping("/api")
	public static class TestController {

		@GetMapping("/test")
		public String testGet() {
			return "this is a test";
		}

		@PostMapping("/test")
		public String testPost(@RequestBody String body) {
			return "test: " + body;
		}
	}


}